/*
	File: Tile.cpp
	Author: Nolan McGlynn( GearMonster1 )
	Class: SGP1 1303
	Purpose: To manage the very basic needs of a tile in the game
*/
#include "Tile.h"
#include "../../SGD_Wrappers/CSGD_TextureManager.h"
#include "../../SGD_Wrappers/CSGD_Direct3D.h"

CTile::CTile(void)
{
	m_eTileType = TILE_GROUND;

	m_pTM = CSGD_TextureManager::GetInstance();
}


CTile::~CTile(void)
{
}

void CTile::Render( void )
{
	RECT ImageRect = { (long)(m_fImagePosX * m_fTileWidth), (long)(m_fImagePosY * m_fTileHeight), 
		(long)(m_fImagePosX * m_fTileWidth + m_fTileWidth), (long)(m_fImagePosY * m_fTileHeight + m_fTileHeight) };

	m_pTM->Draw( m_nImageID, (int)(m_fWorldPosX - m_fTileWidth/2.0f),
		(int)(m_fWorldPosY - m_fTileHeight/2.0f), 1.0f, 1.0f, &ImageRect);
	

}


RECT CTile::GetRect( void )
{
	RECT WorldRect = { (long)(m_fWorldPosX - m_fTileWidth/2.0f), (long)(m_fWorldPosY - m_fTileHeight/2.0f), 
		(long)(m_fWorldPosX + m_fTileWidth/2.0f), (long)(m_fWorldPosY + m_fTileHeight/2.0f) };

	return WorldRect;
}